package cn.zifangsky.jvm.part1.structure;

/**
 * 数组和对象的内存分配
 *
 * @author zifangsky
 * @date 2020/7/2
 * @since 1.0.0
 */
public class ArrayMax {

    public static void main(String[] args) {
        int[] arr = new int[]{2, 3, 4};

        int ret = max(0, arr);
        System.out.println(ret);
    }

    public static int max(int min, int[] arr) {
        int max = min;

        for (int a : arr) {
            if (a > max) {
                max = a;
            }
        }
        return max;
    }

}
